package com.svse.designPattern.behaviour.chainofresponsibility.test;

import com.svse.designPattern.behaviour.chainofresponsibility.impl.ClassAdviser;
import com.svse.designPattern.behaviour.chainofresponsibility.impl.Dean;
import com.svse.designPattern.behaviour.chainofresponsibility.impl.DeanOfStudies;
import com.svse.designPattern.behaviour.chainofresponsibility.impl.DepartmentHead;
import com.svse.designPattern.behaviour.chainofresponsibility.service.Leader;

/**
 * @author LiYuhang
 * @version 0.1
 * @application
 * @Date 2020/8/8 10:57
 */
public class AskForLeave {

    /**
     *   学生请假小于或等于 3 天，班主任可以批准；
     *   小于或等于 7 天，系主任可以批准；
     *   小于或等于 10 天，院长可以批准；
     *   小于或等于 30 天，教务处可以批准；
     *   其他情况不予批准
     *
     */

    public static void main(String[] args) {
        //组装责任链
        Leader classAdviser=new ClassAdviser();
        Leader departmentHead=new DepartmentHead();
        Leader dean=new Dean();
        Leader deanOfStudies=new DeanOfStudies();
        classAdviser.setNextLeader(departmentHead);
        departmentHead.setNextLeader(dean);
        dean.setNextLeader(deanOfStudies);
        //提交请求
        classAdviser.vacate(8);
    }
}
